home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / interp / tclStruct1.2.tar.gz / tclStruct1.2.tar / tclStruct1.2 / configure.in < prev    next >
Text File  |  1995-09-26  |  10KB  |  370 lines

  1. dnl    This file is an input file used by the GNU "autoconf" program to
  2. dnl    generate the file "configure", which is run during Tcl installation
  3. dnl    to configure the system for the local environment.
  4. AC_INIT(stInternal.h)
  5. # @(#) configure.in 1.5 95/09/26 11:26:11
  6.  
  7. #--------------------------------------------------------------------
  8. AC_PREFIX_PROGRAM(tclsh)
  9. AC_ARG_WITH(gcc, , CC=gcc)
  10. AC_ARG_WITH(acc, , CC=acc)
  11. AC_ARG_WITH(lcc, , CC=lcc)
  12. AC_ARG_WITH(cc, , CC=cc)
  13.  
  14. ORIGCLFAGS="$CFLAGS"
  15. AC_PROG_CC
  16. AC_C_CROSS
  17. CFLAGS="$ORIGCFLAGS"
  18. AC_PROG_RANLIB
  19.  
  20. AC_PROG_INSTALL
  21.  
  22. AC_SUBST(CC)
  23.  
  24. #--------------------------------------------------------------------
  25. #    Supply substitutes for missing POSIX library procedures, or
  26. #    set flags so Tcl uses alternate procedures.
  27. #--------------------------------------------------------------------
  28.  
  29. AC_REPLACE_FUNCS(strtol)
  30. AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
  31.  
  32. #--------------------------------------------------------------------
  33. #    On a few very rare systems, all of the libm.a stuff is
  34. #    already in libc.a.  Set compiler flags accordingly.
  35. #    Also, Linux requires the "ieee" library for math to work
  36. #    right (and it must appear before "-lm").
  37. #--------------------------------------------------------------------
  38.  
  39. AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
  40. AC_SUBST(MATH_LIBS)
  41. AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
  42.  
  43. #--------------------------------------------------------------------
  44. #    Supply substitutes for missing POSIX header files.  Special
  45. #    notes:
  46. #        - Sprite's dirent.h exists but is bogus.
  47. #        - stdlib.h doesn't define strtol, strtoul, or
  48. #          strtod insome versions of SunOS
  49. #        - some versions of string.h don't declare procedures such
  50. #          as strstr
  51. #--------------------------------------------------------------------
  52.  
  53. AC_HAVE_HEADERS(unistd.h)
  54. AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
  55. AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
  56. AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
  57. AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
  58. AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
  59. AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
  60. if test $tcl_ok = 0; then
  61.     AC_DEFINE(NO_STDLIB_H)
  62. fi
  63. AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
  64. AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
  65. if test $tcl_ok = 0; then
  66.     AC_DEFINE(NO_STRING_H)
  67. fi
  68.  
  69. #--------------------------------------------------------------------
  70. #    Check for strtoul function.  This is tricky because under some
  71. #    versions of AIX strtoul returns an incorrect terminator
  72. #    pointer for the string "0".
  73. #--------------------------------------------------------------------
  74.  
  75. AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
  76. AC_TRY_RUN([
  77. extern int strtoul();
  78. int main()
  79. {
  80.     char *string = "0";
  81.     char *term;
  82.     int value;
  83.     value = strtoul(string, &term, 0);
  84.     if ((value != 0) || (term != (string+1))) {
  85.         exit(1);
  86.     }
  87.     exit(0);
  88. }], , tcl_ok=0, dummy=1)
  89. if test $tcl_ok = 0; then
  90.     test -n "$verbose" && echo "    Adding strtoul.o."
  91.     LIBOBJS="$LIBOBJS strtoul.o"
  92. fi
  93.  
  94. #--------------------------------------------------------------------
  95. #    Check for the strtod function.  This is tricky because in some
  96. #    versions of Linux strtod mis-parses strings starting with "+".
  97. #--------------------------------------------------------------------
  98.  
  99. AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
  100. AC_TRY_RUN([
  101. extern double strtod();
  102. int main()
  103. {
  104.     char *string = " +69";
  105.     char *term;
  106.     double value;
  107.     value = strtod(string, &term);
  108.     if ((value != 69) || (term != (string+4))) {
  109.     exit(1);
  110.     }
  111.     exit(0);
  112. }], , tcl_ok=0, dummy=1)
  113. if test $tcl_ok = 0; then
  114.     test -n "$verbose" && echo "    Adding strtod.o."
  115.     LIBOBJS="$LIBOBJS strtod.o"
  116. fi
  117.  
  118. #--------------------------------------------------------------------
  119. #    Under Solaris 2.4, strtod returns the wrong value for the
  120. #    terminating character under some conditions.  Check for this
  121. #    and if the problem exists use a substitute procedure
  122. #    "fixstrtod" that corrects the error.
  123. #--------------------------------------------------------------------
  124.  
  125. AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
  126. if test "$tcl_strtod" = 1; then
  127.     AC_MSG_CHECKING([for Solaris strtod bug])
  128.     AC_TRY_RUN([
  129.     extern double strtod();
  130.     int main()
  131.     {
  132.         char *string = "NaN";
  133.         char *term;
  134.         strtod(string, &term);
  135.         if ((term != string) && (term[-1] == 0)) {
  136.         exit(1);
  137.         }
  138.         exit(0);
  139.     }], AC_MSG_RESULT(ok), [
  140.         AC_MSG_RESULT(buggy)
  141.         LIBOBJS="$LIBOBJS fixstrtod.o"
  142.         AC_DEFINE(strtod, fixstrtod)
  143.     ], dummy=1)
  144. fi
  145.  
  146. #--------------------------------------------------------------------
  147. #    Check for various typedefs and provide substitutes if
  148. #    they don't exist.
  149. #--------------------------------------------------------------------
  150.  
  151. AC_TYPE_MODE_T
  152. AC_TYPE_SIZE_T
  153.  
  154. #--------------------------------------------------------------------
  155. #    Check to see whether the system supports the matherr function
  156. #    and its associated type "struct exception".
  157. #--------------------------------------------------------------------
  158.  
  159. AC_MSG_CHECKING([matherr support])
  160. AC_TRY_COMPILE([#include <math.h>], [
  161. struct exception x;
  162. x.type = DOMAIN;
  163. x.type = SING;
  164. ], tcl_ok=yes, tcl_ok=no)
  165. AC_MSG_RESULT($tcl_ok)
  166. if test $tcl_ok = yes; then
  167.     AC_DEFINE(NEED_MATHERR)
  168. fi
  169.  
  170. #--------------------------------------------------------------------
  171. #    See if we can find the Tcl binary
  172. #--------------------------------------------------------------------
  173.  
  174. AC_CHECK_PROG(TCLSH, tclsh, tclsh )
  175. AC_CHECK_PROG(TCLSH, tcl, tcl )
  176. AC_SUBST(TCLSH)
  177.  
  178. if test -z "$TCLSH" ; then
  179.     AC_MSG_ERROR([cannot find installed Tcl binary])
  180. fi
  181.  
  182. AC_MSG_CHECKING([for Tcl version])
  183. changequote(, )
  184. TCLVERSION=`echo "puts stdout [info tclversion]" | $TCLSH`
  185. changequote([, ])
  186. AC_SUBST(TCLVERSION)
  187. AC_MSG_RESULT([$TCLVERSION])
  188.  
  189. TCLLIBRARY="-ltcl$TCLVERSION"
  190. if test "x$TCLLIBRARY" = "x" ; then
  191.     AC_CHECK_LIB(tcl, main, [TCLLIBRARY="-ltcl$TCLVERSION"], , [-lm])
  192. fi
  193. if test "x$TCLLIBRARY" = "x" ; then
  194.     AC_MSG_ERROR([cannot find installed Tcl library])
  195. fi
  196. AC_SUBST(TCLLIBRARY)
  197.  
  198.  
  199.  
  200. #--------------------------------------------------------------------
  201. #    The statements below define a collection of symbols related to
  202. #    dynamic loading and shared libraries.  See Makefile.in for a
  203. #    description of each of the symbols.
  204. #--------------------------------------------------------------------
  205.  
  206. AC_MSG_CHECKING([system version])
  207. system=`uname -s`-`uname -r`
  208. if test "$status" = 1 ; then
  209.     AC_MSG_RESULT([unknown (can't find uname command)])
  210.     system=unknown
  211. else
  212.     # Special check for weird MP-RAS system
  213.     if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  214.     system=MP-RAS-`awk '{print $3}' /etc/.relid`
  215.     fi
  216.     AC_MSG_RESULT($system)
  217. fi
  218. AC_ARG_ENABLE(load, [  --disable-load          disallow dynamic loading and "load" command],
  219.     [tcl_ok=$enableval], [tcl_ok=yes])
  220. if test "$tcl_ok" = "no"; then
  221.     system=unknown
  222. fi
  223.  
  224. CCOPTIONS="-O"
  225.  
  226. case $system in
  227.     AIX-*)
  228.     # Warning:  the AIX definitions have never been tested and I'm
  229.     # pretty sure that they don't work as is.  This code is just
  230.     # a starting point for a real implementation.
  231.     # SHLIB_CFLAGS=""
  232.     # SHLIB_LD="/bin/ld -e _nostart -berok  -bM:SRE -bE:lib$(LIBNAME).exp -H512 -T512"
  233.     # SHLIB_SUFFIX=".so"
  234.     # DL_LIBS=""
  235.     # LD_FLAGS=""
  236.     echo "Dynamic loading isn't available yet under AIX."
  237.     echo "Want to volunteer?"
  238.     ;;
  239.     HP-UX-*.08.*|HP-UX-*.09.*)
  240.     if test "$CC" = "cc" ; then
  241.         CCOPTIONS="-Aa -O"
  242.     fi
  243.     SHLIB_CFLAGS="+z"
  244.     SHLIB_LD="ld -b"
  245.     SHLIB_SUFFIX=".sl"
  246.     DL_LIBS="-ldld"
  247.     LD_FLAGS="-Wl,-E"
  248.     ;;
  249.     IRIX-5.*)
  250.     SHLIB_CFLAGS=""
  251.     SHLIB_LD="ld -shared -rdata_shared"
  252.     SHLIB_SUFFIX=".so"
  253.     DL_LIBS=""
  254.     LD_FLAGS=""
  255.     ;;
  256.     Linux*)
  257.     SHLIB_CFLAGS="-fpic"
  258.     SHLIB_LD="ld -shared"
  259.     SHLIB_SUFFIX=".so"
  260.     DL_LIBS="-ldld"
  261.     LD_FLAGS=""
  262.     ;;
  263.     OSF-1.*)
  264.     SHLIB_CFLAGS="-fpic"
  265.     SHLIB_LD='ld -shared -expect_unresolved "*"'
  266.     SHLIB_SUFFIX=".so"
  267.     DL_LIBS=""
  268.     LD_FLAGS=""
  269.     ;;
  270.     OSF1-V*)
  271.     SHLIB_CFLAGS=""
  272.     SHLIB_LD='ld -shared -expect_unresolved "*"'
  273.     SHLIB_SUFFIX=".so"
  274.     DL_LIBS=""
  275.     LD_FLAGS=""
  276.     ;;
  277.     SunOS-4*)
  278.     SHLIB_CFLAGS="-pic"
  279.     SHLIB_LD="ld -assert pure-text"
  280.     SHLIB_SUFFIX=".so"
  281.     DL_LIBS="-ldl"
  282.     LD_FLAGS=""
  283.     ;;
  284.     SunOS-5*)
  285.     SHLIB_CFLAGS="-K pic"
  286.     SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  287.     SHLIB_SUFFIX=".so"
  288.     DL_LIBS="-ldl"
  289.     LD_FLAGS=""
  290.     ;;
  291.     NetBSD-*|FreeBSD-*)
  292.     # Not available on all versions:  check for include file.
  293.     if test -e /usr/include/dlfcn.h; then
  294.         SHLIB_CFLAGS="-fpic"
  295.         SHLIB_LD="ld -Bshareable"
  296.         SHLIB_SUFFIX=".so"
  297.         DL_LIBS=""
  298.         LD_FLAGS=""
  299.     fi
  300.     ;;
  301.     SCO_SV-3.2*)
  302.     # Note, dlopen is available only on SCO 3.2.5 and greater...
  303.     SHLIB_CFLAGS="-Kpic -belf"
  304.     SHLIB_LD="ld -G -z text"
  305.     SHLIB_SUFFIX=".so"
  306.     DL_LIBS=""
  307.     LD_FLAGS="-belf -Wl,-Bexport"
  308.     ;;
  309.     MP-RAS-02*)
  310.     if test "$CC" = "cc" ; then
  311.         CCOPTIONS="-Xa -O"
  312.     fi
  313.     SHLIB_CFLAGS="-K pic"
  314.     SHLIB_LD="cc -G"
  315.     SHLIB_SUFFIX=".so"
  316.     DL_LIBS="-ldl"
  317.     LD_FLAGS=""
  318.     ;;
  319.     MP-RAS-*)
  320.     if test "$CC" = "cc" ; then
  321.         CCOPTIONS="-Xa -O"
  322.     fi
  323.     SHLIB_CFLAGS="-K pic"
  324.     SHLIB_LD="cc -G"
  325.     SHLIB_SUFFIX=".so"
  326.     DL_LIBS="-ldl"
  327.     LD_FLAGS="-Wl,-Bexport"
  328.     ;;
  329.     UNIX_SV*)
  330.     SHLIB_CFLAGS="-K pic"
  331.     SHLIB_LD="cc -G"
  332.     SHLIB_SUFFIX=".so"
  333.     DL_LIBS="-ldl"
  334.     LD_FLAGS="-Wl,-Bexport"
  335.     ;;
  336. esac
  337.  
  338. if test "x$SHLIB_SUFFIX" != "x" ; then
  339.     BUILD_DLTEST="loadTests"
  340.     LIB_SUFFIX=$SHLIB_SUFFIX
  341. else
  342.     echo "Can't figure out how to do dynamic loading or shared libraries"
  343.     echo "on this system."
  344.     SHLIB_CFLAGS=""
  345.     SHLIB_LD=""
  346.     SHLIB_SUFFIX=""
  347.     DL_LIBS=""
  348.     LD_FLAGS=""
  349.     BUILD_DLTEST=""
  350.     LIB_SUFFIX=.a
  351. fi
  352.  
  353. if test "$CC" = "gcc" -a "x$SHLIB_SUFFIX" != "x" ; then
  354.     SHLIB_CFLAGS="-fpic"
  355. fi
  356.  
  357. AC_SUBST(CCOPTIONS)
  358. AC_SUBST(LIB_SUFFIX)
  359. AC_SUBST(SHLIB_CFLAGS)
  360. AC_SUBST(SHLIB_LD)
  361. AC_SUBST(SHLIB_SUFFIX)
  362. AC_SUBST(DL_LIBS)
  363. AC_SUBST(LD_FLAGS)
  364. AC_SUBST(BUILD_DLTEST)
  365.  
  366.  
  367.  
  368.  
  369. AC_OUTPUT(Makefile)
  370.